<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
	#div1{
		height:300px;
	}
</style>
<script>
	window.onload= function (){
		var objDiv = document.getElementById("div1");
		alert(getAttrValue(objDiv,"height"));
	}
	
	// 获取非行间样式
	function getAttrValue(objHtml,attrHtml){
		if(objHtml.currentStyle){
			alert("11111");
			return objHtml.currentStyle[attrHtml];
		}else{
			alert("22222");
			return getComputedStyle(objHtml,false)[attrHtml];
		}
	}
</script>
</head>

<body>
<div id="div1" width="200px;">
</div>
</body>
</html>
